package com.ganbo.pattern.proxy.staticproxy;

/**
 * 静态代理对象
 *
 * @Author: ganbo
 * @Date: 2020/6/9 18:07
 */
public class UserServiceProxy implements IUserService {

    private IUserService target;

    public UserServiceProxy(IUserService target) {
        this.target = target;
    }

    public void work(String name) {
        before();
        target.work(name);
        after();
    }

    private void before() {
        System.out.println("早上开车到公司.");
    }

    private void after() {
        System.out.println("工作完毕,下班。");
    }
}
